package properties

type Instance struct {
	InstanceId                    interface{}    `json:"instanceId"`
	HostName                      interface{}    `json:"hostName"`
	App                           interface{}    `json:"app"`
	IpAddr                        interface{}    `json:"ipAddr"`
	Status                        interface{}    `json:"status"`
	Overriddenstatus              interface{}    `json:"overriddenstatus"`
	CountryId                     interface{}    `json:"countryId"`
	HomePageUrl                   interface{}    `json:"homePageUrl"`
	StatusPageUrl                 interface{}    `json:"statusPageUrl"`
	HealthCheckUrl                interface{}    `json:"healthCheckUrl"`
	VipAddress                    interface{}    `json:"vipAddress"`
	SecureVipAddress              interface{}    `json:"secureVipAddress"`
	IsCoordinatingDiscoveryServer interface{}    `json:"isCoordinatingDiscoveryServer"`
	ActionType                    interface{}    `json:"actionType"`
	Port                          PortWapper     `json:"port"`
	SecurePort                    PortWapper     `json:"securePort"`
	DataCenterInfo                DataCenterInfo `json:"dataCenterInfo"`
	LeaseInfo                     LeaseInfo      `json:"leaseInfo"`
	Metadata                      Metadata       `json:"metadata"`
}

type PortWapper struct {
	Enabled string `json:"@enabled"`
	Port    string `json:"$"`
}

type DataCenterInfo struct {
	Class string `json:"@class"`
	Name  string `json:"name"`
}

type LeaseInfo struct {
	RenewalIntervalInSecs string `json:"renewalIntervalInSecs"`
	DurationInSecs        string `json:"durationInSecs"`
	ServiceUpTimestamp    string `json:"serviceUpTimestamp"`
}

type Metadata struct {
	Class string `json:"@class"`
}

func NewDefaultInstanceInfo() Instance {
	var port PortWapper = PortWapper{Enabled: "true", Port: "8080"}
	var secPort PortWapper = PortWapper{Enabled: "false", Port: "443"}
	var leaseInfo LeaseInfo = LeaseInfo{RenewalIntervalInSecs: "30", DurationInSecs: "90"}
	var dataCenterInfo DataCenterInfo = DataCenterInfo{Class: "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo", Name: "MyOwn"}
	var metadata Metadata = Metadata{Class: "java.util.Collections$EmptyMap"}

	var instance Instance = Instance{}
	instance.Port = port
	instance.SecurePort = secPort
	instance.LeaseInfo = leaseInfo
	instance.DataCenterInfo = dataCenterInfo
	instance.Metadata = metadata
	instance.CountryId = "1"
	instance.Status = "UP"
	instance.Overriddenstatus = "UNKNOWN"
	instance.IsCoordinatingDiscoveryServer = "false"
	instance.ActionType = "ADDED"
	return instance
}
